package com.briup.demo.service.impl;
import com.briup.demo.bean.Privilege;
import com.briup.demo.dao.PrivilegeMapper;
import com.briup.demo.service.IPrivilegeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class PrivilegeServiceImpl implements IPrivilegeService {
@Resource
    private  PrivilegeMapper privilegeMapper;

    @Override
    public List<Privilege> findAll() {
        return privilegeMapper.selectALL();
    }

    @Override
    public void saveOrUpdate(Privilege privilege) {
        if (privilege.getId() != null) {
            privilegeMapper.update(privilege);
        }
        else {
            privilegeMapper.insert(privilege);
        }

    }

    @Override
    public void delete(Long id) {
        privilegeMapper.delete(id);
    }
}
